import request from "@/utils/request";

export const getBanner = () => {
  return request({
    url: "/api/home/banner",
    method: "get"
  })
}

interface productList {
  current?: number,
  pageSize?: number
}
export const getProductList = (params:productList) => {
  return request({
    url: "/api/product/queryProductList",
    method: "get",
    params
  })
}

export const getProductDetail = (productId:number) => {
  return request({
    url: "/api/product/queryProduct",
    method: "get",
    params: {
      productId
    }
  })
}

interface blogList {
  showStatus?: number,
  recommendStatus?: number,
  current?: number,
  pageSize?: number
}
export const getBlogList = (params:blogList) => {
  return request({
    url: "/api/blog/queryBlogList",
    method: "get",
    params
  })
}

export const getBlogDetail = (id:number) => {
  return request({
    url: "/api/blog/queryBlog",
    method: "get",
    params: {
      id
    }
  })
}
interface subscribe{
  email:string
}
export const addSubscribe = (data:subscribe) => {
  return request({
    url: "/api/user/addSubscribe",
    method: "post",
    data
  })
}

interface orderParams{
  order_currency:string,
  order_amount:string,
  billing_firstName:string,
  billing_lastName:string,
  billing_email:string,
  secure_code:string
}
export const getOrder = (params:orderParams) => {
  return request({
    url: "/api/pay/orderPayPrepare",
    method: "post",
    params
  })
}

interface affiliateParams{
  email: string
  first_name: string
  last_name: string
  website?: string
  instagram: string
  tiktok?: string
  x?: string
  youtube?: string
  details?: string
}
export const addAffiliate = (data:affiliateParams) => {
  return request({
    url: "/api/user/addAffiliate",
    method: "post",
    data
  })
}